import { DIALOG_DATA } from '@angular/cdk/dialog';
import { Component, Inject } from '@angular/core';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
import { MatCardModule } from '@angular/material/card';
import { FormsModule } from '@angular/forms';
import * as ace from 'ace-builds';   

@Component({
  selector: 'app-settings-dialog',
  standalone: true,
  imports: [MatExpansionModule,MatSlideToggleModule,MatCardModule,FormsModule],
  templateUrl: './settings-dialog.component.html',
  styleUrl: './settings-dialog.component.sass'
})
export class SettingsDialogComponent {
 
  constructor(@Inject(DIALOG_DATA) public data: { editor: ace.Ace.Editor }) {
    this.editor = data.editor;
    this.autoWrapStatus = this.editor.getSession().getUseWrapMode();
  }
 
  editor: ace.Ace.Editor;
 
  themeStatus = false;
  typefaceStatus = false;
  autoWrapStatus = false;

  changeAutoWrap() {
      this.editor.session.setUseWrapMode(this.autoWrapStatus);
      this.editor.session.setWrapLimitRange(0, 0);
      localStorage.setItem("editor.WrapMode",this.autoWrapStatus?"1":"0") 
  }

}
